<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const num = {
            a: 10,
            add() {
                return this.a + 2
            },
            reduce: () => this.a - 2
        }
        console.log(num.add()) // 12
        console.log(num.reduce()) // NaN
        const promise = new Promise((resolve, reject) => {
            console.log(1)
            setTimeout(() => {
                console.log('timeStart');
                resolve('success')
                console.log('timeEnd');
            }, 0)
            console.log(2);
        })
        promise.then(res => {
            console.log(res);
        })
        console.log(4);
        // 1 2 4 timeStart timeEnd success
    </script>
</body>
</html>